<template>
	<view class="container">
		<view class="title">
			<text>目前手机端不支持导入功能</text>
			<text>请登录PC端进行题库导入操作</text>
		</view>
		<view class="weburl">
			<view>
				<text>网址：</text>
				<text class="blue" >{{info}}</text>
			</view>
			<image src="/static/images/copy.png" mode="widthFix" @tap="getDetail(info)"></image>
		</view>
		<view class="image">
			<image src="/static/images/imort1.png" mode=""></image>
		</view>
	</view>
</template>
<script>
	export default{
		data(){
			return{
				info:'http://sah.bsschina.net'
			}
		},
		methods:{
			getDetail(info) {
				let text = info
				// #ifdef H5
				let textarea = document.createElement("textarea")
				textarea.value = text 
				textarea.readOnly = "readOnly"
				document.body.appendChild(textarea)
				textarea.select() // 选中文本内容
				textarea.setSelectionRange(0, text.length) 
				uni.showToast({//提示
					title:'复制成功' ,
					icon:'success'
				})
				document.execCommand("copy") 
				textarea.remove()
				// #endif
				// #ifndef H5
				uni.setClipboardData({
				  data:text,//要被复制的内容
				  success:()=>{//复制成功的回调函数
					uni.showToast({//提示
					  title:`复制成功`,
					  icon:'success'
					})
				  }
				},true);
				// #endif

			}

		}
	}
</script>

<style lang="scss">
	.container{
		background-color: #fff;
		height: 100vh;
		padding-top: 20px;
		.title{
			width: 220px;
			margin:0 auto;
			margin-top: 114px;
			line-height: 32px;
			text{
				display: block;
				text-align: center;
			}
		}
		.weburl{
			width: 230px;
			margin: 0 auto;
			margin-top: 20px;
			display: flex;
			align-items: center;
			justify-content: space-between;
			.blue{
				color: #508CFF;
			}
			image{
				width: 16px;
				height: 16px;
			}
		}
		.image{
			text-align: center;
			margin-top: 80px;
			image{
				width: 168px;
				height: 106px;
			}
		}
	}
</style>